package com.itheima.service.impl;

import com.itheima.dao.UserMapper;
import com.itheima.model.domain.User;
import com.itheima.service.IuserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
//import com.itheima.utils.Commons;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
@Service
@Transactional
public class UserServiceImpl implements IuserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public void publish(User user){

        java.sql.Date sqlDate=new java.sql.Date(new java.util.Date().getTime());
        user.setCreated(sqlDate);
        user.setValid(1);
        userMapper.insertUser(user);

    }
}
